<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
 * Summary : 文章_标签视图
 * Author : Steven Wang
 * Date : 16 Oct,2011
 */
class V_Tag extends CI_Model
{
	protected $_name = "v_article_tag";

	function __construct()
    {
        parent::__construct();
    }

    /*
     * summary : 根据文章ID获取其相应的所属标签(标签ID和标签名称)
     * author : Steven Wang
     * date : 16 Oct,2011
     *
     * params :
     * <int>$articleId : 要获取标签的文章ID
     *
     * return :
     * array(2) {
  	 * [0]=>
  	 * 	    array(1) {
     *      ["Blog_Tag_Name"]=>string(6) "..."
  	 *    }
  	 * [1]=>
  	 *      array(1) {
     *		["Blog_Tag_Name"]=>string(6) "..."
  	 *	  }
	 * }
	 */
    function getTagNamesByArticleId($articleId)
    {
    	$this->db
    		->select(array(
	    		"Blog_Tag_ID",
          "Blog_Tag_Name"
	    	))
	    	->from($this->_name)
	    	->where("Blog_Article_ID",$articleId);
	    $query = $this->db->get();
	    $result = $query->result_array();
	    return $result;
    }

    /*
     * summary : 根据文章ID获取其相应的所属标签(全部信息)
     * author : Steven Wang
     * date : 16 Oct,2011
     *
     * params :
     * <int>$articleId : 要获取标签的文章ID
     *
     * return :
     * array(2) {
     * [0]=>
     *      array(1) {
     *      ["Blog_Tag_Name"]=>string(6) "..."
     *    }
     * [1]=>
     *      array(1) {
     *    ["Blog_Tag_Name"]=>string(6) "..."
     *    }
   * }
   */
    function getTagsByArticleId($articleId)
    {
      $this->db
        ->select(array(
          "*"
        ))
        ->from($this->_name)
        ->where("Blog_Article_ID",$articleId);
      $query = $this->db->get();
      $result = $query->result_array();
      return $result;
    }
}





 ?>